<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<f:view>
	<h:head>
		<link type="text/css" rel="stylesheet" href="themes/bluesky/skin.css" />
		<link type="text/css" rel="stylesheet"
			href="resources/css/wienerhelden.css" />
	</h:head>
	<h:body>
		<ui:composition template="template.xhtml">
			<ui:define name="content">
				<h1>Repair-Ticket-Creation</h1>
				<dl>
						<dt>Ticket ID:</dt>
						<dd>
							<h:outputText value="#{createRepairTicketController.ticket.id}"/></dd>
						<dt>Description:</dt>
						<dd>
							<h:outputText value="#{createRepairTicketController.ticket.surveyorDescription}"/>
						</dd>
					</dl>
				<h:form id="repairTicketCreationForm">
					<div class="formBlock">
					
					
					<fieldset>
						<legend>
							<h:outputText value="Partner Selection" />
						</legend>
						<div>
							<h:outputLabel for="typeOfDamage" value="Type of Damage:" />
							<p:selectOneMenu id="typeOfDamage"
								value="#{createRepairTicketController.typeOfDamage}">
								<f:selectItem itemLabel="Electro defect" itemValue="1" />
								<f:selectItem itemLabel="Water damage" itemValue="2" />
								<f:selectItem itemLabel="Fire damage" itemValue="3" />
								<f:selectItem itemLabel="Gas defect" itemValue="4" />
								<f:selectItem itemLabel="Mold" itemValue="5" />
								<p:ajax update="partners-wrapper"
									listener="#{createRepairTicketController.handleDamageChange}" />
							</p:selectOneMenu>
						</div>
						<h:panelGroup layout="block" id="partners-wrapper">
							<h:outputLabel for="partners" value="Recommended Partners:"/> 
							<p:selectOneListbox id="partners" required="true"
							value="#{createRepairTicketController.selectedPartner}"
							var="partner" style="width:200px">
							<f:selectItems value="#{createRepairTicketController.partners}"
								var="partner" itemLabel="#{partner.name}"
								itemValue="#{partner.name}" />
							<p:column>  
                					#{partner.name}
           						 </p:column>
							<p:column>  
                					#{partner.telNo}
           						 </p:column>
							<p:column>  
                					#{partner.email}
           						 </p:column>
							</p:selectOneListbox>
						</h:panelGroup>
						<div>
							<p:commandButton id="submitData" value="Finish Repair Ticket"
								icon="ui-icon-check"
								action="#{createRepairTicketController.finish}" />
						</div>
					</fieldset>
					</div>
				</h:form>
			</ui:define>
		</ui:composition>
	</h:body>
</f:view>
</html>
